import function,shutil,os
import mysql.connector


paths1=function.get_file_paths("D:/Desk/系统图库/烫画集/1-待处理/缩小/")

pics=[]
for path in paths1:
    pic=os.path.basename(path)    
    pics.append(pic)
    path_new="D:/Desk/系统图库/烫画集/3-图案集/"+pic
    path_new3="Y:/pic/tanghua/"+pic    
    shutil.move(path,path_new)
    shutil.move(path,path_new3)
    path2="D:/Desk/系统图库/烫画集/1-待处理/标注/"+pic
    path_new2="D:/Desk/系统图库/烫画集/2-尺寸集/"+pic
    shutil.move(path2,path_new2)
    print(pic,"移动完成")

# print(pics)

mydb = mysql.connector.connect(
  host="192.168.10.81",
  user="root",
  passwd="",
  database="xiaocheng"
)
mycursor = mydb.cursor()
str="('"+"','".join(pics)+"')"
query = ("update pattern set operate='处理完' where pic in "+str)
mycursor.execute(query)
mydb.commit()
print(mycursor.rowcount, " 条记录更新")